package bpui.views;

import java.util.ArrayList;

import org.wat.wcy.isi.mmazur.bp.io.NodeType;

import bpui.views.NavigationView.ObjectType;

public @SuppressWarnings("unchecked")
class TreeParent extends TreeObject {
	private ArrayList children;
	public TreeParent(String name) {
		super(name);
		children = new ArrayList();
	}
	
	public TreeParent(String name, String id, ObjectType type, String process) {
		super(name);
		this.id = id;
		children = new ArrayList();
		this.process = process;
		this.type = type;
	}
	
	public TreeParent(String name, String id, ObjectType type, NodeType nodeType, String process) {
		super(name);
		this.id = id;
		this.process = process;
		children = new ArrayList();
		this.type = type;
		this.nodeType = nodeType;
	}
	
	public void addChild(TreeObject child) {
		children.add(child);
		child.setParent(this);
	}
	public void removeChild(TreeObject child) {
		children.remove(child);
		child.setParent(null);
	}
	public TreeObject[] getChildren() {
		return (TreeObject[]) children.toArray(new TreeObject[children.size()]);
	}
	public boolean hasChildren() {
		return children.size()>0;
	}
	
}
